import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from '../views/LoginView.vue'
import SignView from '../views/SignView.vue'
import DetaileView from '@/views/DetaileView.vue'
import CarViewVue from '@/views/CarView.vue'
import ConfirmorderView from '../views/ConfirmorderView.vue'
import AddressView from '../views/AddressView.vue'
import AddressEditView from '../views/AddressEditView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
    {
      path: '/sign',
      name: 'sign',
      component: SignView,
    },
    {
      path: '/detaile/:id',
      name: 'detaile',
      component: DetaileView,
    },
    {
      path: '/car',
      name: 'car',
      component: CarViewVue,
    },
    {
      path: '/confirmorder',
      name: 'confirmorder',
      component: ConfirmorderView,
    },
    {
      path: '/address',
      name: 'address',
      component: AddressView
    },
    {
      path: '/addressedit',
      name: 'addressedit',
      component: AddressEditView
    },
    {
      path: '/addressupdate/:index',
      name: 'addressupdate',
      component: () => import('@/views/AddressUpdateView.vue')
    },
    {
      path: '/category',
      name: 'category',
      component: () => import('../views/CategoryView.vue')
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('../views/SearchView.vue')
    },


    {
      path: '/list/:brand',
      name: 'list',
      component: () => import('../views/ListView.vue')
    },

    {
      path: '/center',
      name: 'center',
      component: () => import('../views/CenterView.vue')
    },

    {
      path: '/order',
      name: 'order',
      component: () => import('../views/OrderView.vue')
    },

    {
      path: '/orderdetail/:time',
      name: 'orderdetail',
      component: () => import('../views/OrderDetailView.vue')
    },





    {
      path: '/404',
      name: 'notFound',
      component: () => import('@/views/404.vue')
    },
    {
      path: "/:pathMatch(.*)*",
      redirect: '/404'
    }
  ]
})

export default router
